package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.block.common.enums.BaseTypeInfoEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 聚享花双授权
 */
public class JuXiangHuaSsqUtil {

    public static Integer getCar(String car) {
        if (StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Car.car002.getValue(), car)) {
            return 2;
        }
        return 1;
    }

    public static Integer getGjj(String gongjijin) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj001.getValue(), gongjijin)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj002.getValue(), gongjijin)) {
            return 1;
        }
        return 2;
    }

    public static Integer getSocialInsurance(String shebao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb001.getValue(), shebao)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb002.getValue(), shebao)) {
            return 1;
        }
        return 2;
    }

    public static Integer getHouse(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.House.hu002.getValue(), house) || StrUtil.equals(BaseTypeInfoEnum.House.hu004.getValue(), house)) {
            return 1;
        }
        return 2;
    }

    public static Integer getbaodan(String baodan) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baodan)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx002.getValue(), baodan)) {
            return 1;
        }
        return 2;
    }

    public static Integer getXinyongka(String xyk){
        if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk001.getValue(), xyk)) {
            return 0;
        }
        return 1;
    }

    public static Integer getjob(String job) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz001.getValue(), job)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz003.getValue(), job)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz004.getValue(), job)) {
            return 4;
        }
        return 3;
    }

    public static Integer getloan(String loan) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), loan)) {
            return 10000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), loan)){
            return 30000;
        }else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), loan)) {
            return 50000;
        }else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la004.getValue(), loan)) {
            return 100000;
        }
        return 200000;
    }

    public static String getReqIp(String ip){
        if (StringUtils.isNotEmpty(ip)){
            return ip;
        }
        return "127.0.0.1";
    }

    public static Integer getZhimaScore(String zhima) {
        if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm001.getValue(), zhima) || StrUtil.equals(BaseTypeInfoEnum.Zhima.zm002.getValue(), zhima)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm003.getValue(), zhima)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm004.getValue(), zhima)) {
            return 2;
        }
        return 3;
    }

    public static Integer getXueli(String xueli){
        if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl001.getValue(), xueli) || StrUtil.equals(BaseTypeInfoEnum.XueLi.xl002.getValue(), xueli)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl003.getValue(), xueli)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl004.getValue(), xueli)) {
            return 2;
        }
        return 3;
    }

    public static Integer getyuqi(String yuqi) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq001.getValue(), yuqi)) {
            return 0;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq003.getValue(), yuqi) || StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq004.getValue(), yuqi) || StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq005.getValue(), yuqi)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq002.getValue(), yuqi)) {
            return 2;
        }
        return 3;
    }

    public static Integer getHuabei(String huabei){
        if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb001.getValue(),huabei)){
            return 0;
        }else {
            return 1;
        }
    }

    public static Integer getBaitiao(String baitiao){
        if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt001.getValue(),baitiao)){
            return 0;
        }else {
            return 1;
        }
    }

}
